package com.demo2do.fms.queue.scheduler;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.demo2do.fms.queue.service.RemoteDispatchOrderService;

/**
 *
 * @author Ark
 *
 */
@Component("remoteDispatchOrderScheduler")
public class RemoteDispatchOrderScheduler {
    
    private static final Logger logger = LoggerFactory.getLogger(RemoteDispatchOrderScheduler.class);

    @Autowired
    private RemoteDispatchOrderService remoteDispatchOrderService;
    
    /**
     * 派车单完成
     */
    @Scheduled(cron = "0 0/5 * * * ?")
    public void finishOrder() {
        
        logger.info("#finishOrder() - finish order start...");
        
        remoteDispatchOrderService.finish();
        
        logger.info("#finishOrder() - finish order end...");
        
    }
    
    /**
     * 派车单
     */
    @Scheduled(cron = "0 0/5 * * * ?")
    public void editOrder() {
        
        logger.info("#editOrder() - edit order start...");
        
        remoteDispatchOrderService.edit();
        
        logger.info("#editOrder() - edit order end...");
        
    }
    
}
